﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'proc_cm_GetBlogEntry')
BEGIN
    PRINT 'Dropping Procedure proc_cm_GetBlogEntry'
    DROP  Procedure  proc_cm_GetBlogEntry
END
GO

PRINT 'Creating Procedure proc_cm_GetBlogEntry'
GO

CREATE PROCEDURE [dbo].[proc_cm_GetBlogEntry]
	@pBlogId uniqueidentifier
AS
BEGIN
	SET NOCOUNT ON

	SELECT 
		be.[blog_id]
		,be.[html_page_id]
		,be.[title_txt]
		,be.[subtitle_txt]
		,be.[content_txt]
		,be.[UserId]
		,u.[UserName]
		,be.[create_dttm]
		,be.[update_dttm]
	FROM 
		[dbo].[tbl_blog_entry] be (nolock)
		INNER JOIN [dbo].[aspnet_Users] u (nolock) ON be.UserId = u.UserId
	WHERE
		be.[blog_id] = @pBlogId
END
GO

GRANT EXEC ON dbo.proc_cm_GetBlogEntry TO PUBLIC
GO

